//
//  GrabModel.m
//  YYZB
//
//  Created by QZH的Mac on 16/4/6.
//
//

#import "GrabModel.h"

@implementation GrabModel

- (NSDateFormatter *)dateFormatter {
    NSDateFormatter *f = [[NSDateFormatter alloc] init];
    f.dateFormat = @"yyyy-MM-dd HH:mm:ss";
    return f;
}

- (NSString *)formattedServetime {
    NSDate *d = [[self dateFormatter] dateFromString:self.servetime];
    NSDateFormatter *f = [[NSDateFormatter alloc] init];
    f.dateFormat = @"yyyy-MM-dd HH:mm";
    return [f stringFromDate:d];
}

-(NSMutableArray*)model:(NSArray *)items{
    
    //NSLog(@"[[[[[[[[[%@",items);
    
    NSMutableArray * array = [NSMutableArray new];
    
    for (NSDictionary * dic in items) {
        GrabModel * model = [GrabModel new];
        model.serveName = [dic valueForKey:@"ServiceProductName"];
        model.firstaddress = [dic valueForKey:@"CusAddress"];
        model.secondaddress = [dic valueForKey:@"CusAddress"];
        model.ordermark = [dic valueForKey:@"OrderRemark"];
        model.servetime = [dic valueForKey:@"SelectServiceDate"];
        model.distance = [dic valueForKey:@"Distance"];
        model.price = [dic valueForKey:@"Price"];
        
        model.orderid = [dic valueForKey: @"Id"];
        model.orderPay = [dic valueForKey:@"OrderPayStatus"];
        model.serveSmallid = [dic valueForKey:@"Servicecat2Id"];
        model.serveSmallName = [dic valueForKey:@"ServiceCat1Name"];
        model.serviceBigid = [dic valueForKey:@"Servicecat1Id"];
        model.serviceBigName = [dic valueForKey:@"ServiceCat1Name"];
        model.customerName = dic[@"CustomerName"];
        model.phoneNumber = dic[@"PhoneNumber"];
        model.status = dic[@"OrderStatus"];
        
        model.receiverAddress = dic[@"RecieverAddressName"];
        model.helperToFromDistance = dic[@"HelperToFromDistance"];
        model.helperToRecieveDistance = dic[@"HelperToRecieveDistance"];
        model.markup = [dic[@"IsMarkUp"] boolValue];
        model.markupValue = dic[@"MarkUp"];
        model.goodsDescription = dic[@"GoodsDescription"];
        model.helpDescription = dic[@"HelpDescription"];
        model.totalNumber = dic[@"TotalNumber"];
        
        [array addObject:model];

    }
    
    return array;

    
}
@end
